//
//  hyHomeTableViewController.m
//  anjuke
//
//  Created by jim Yao on 15/12/27.
//  Copyright © 2015年 anjuke. All rights reserved.
//

#import "hyHomeTableViewController.h"
#import "hyChangeCityViewController.h"


@interface hyHomeTableViewController ()
@property (nonatomic,strong)NSMutableArray *cityArr;
@end

@implementation hyHomeTableViewController
//1.导航栏图片和标题的位子不对。


- (void)viewDidLoad {
    [super viewDidLoad];
    [self setNav];
    [self getCityData];
    
    self.view.backgroundColor =[UIColor redColor];

}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 4;
}

#pragma mark - 方法

- (void)getCityData{
//    NSURLSessionConfiguration *config = [NSURLSessionConfiguration defaultSessionConfiguration];
//    
//    AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration: config];
    
    
    
    
    
}
- (void)setNav{
    
    UIButton *btn =[[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
    
    [btn setTitle:@"123" forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:@"anjuke61_icon6_selected@2x.png.base.universal.regular.off.horizontal.normal.active.onepartscale.onepart.15427.000.00."] forState:UIControlStateNormal];
    UISearchBar *search = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 220, 50)];
    search.placeholder=@"搜索";

    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithCustomView:btn];
    UIBarButtonItem *item1 =[[UIBarButtonItem alloc] initWithCustomView:search];
        NSArray *arr = @[item,item1];
    self.navigationItem.leftBarButtonItems =arr;
    [btn addTarget:self action:@selector(showCities) forControlEvents:UIControlEventTouchUpInside];
    
}

- (void)showCities{
    hyChangeCityViewController *cityVC = [[hyChangeCityViewController alloc] init];
    
    UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:cityVC];

    
//    [self presentModalViewController:cityVC animated:YES];
    
    [self presentViewController:nav animated:YES completion:nil];
}



@end








